var wineApp = wineApp || {};
wineApp.about = (function() {
    wx.config({
        debug: false,
        appId: 'wxb2cd0d2341253816',
        timestamp: _.now(),
        nonceStr: 'ecfvteshqccsnwt',
        signature: 'cc704d1dbc77bb60156ec4d894f3b770bf12d9da',
        jsApiList: ['checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'hideMenuItems', 'showMenuItems']
    });

    wx.checkJsApi({
        jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo'],
        success: function(res) {}
    });

    wx.ready(function() {
        wx.onMenuShareTimeline({
            title: '好友张扬推荐“安东尼奥” 百年酒庄 品牌故事, 好东西自然要分享^_^',
            link: 'http://wine.moqle.com/wx/newslist?plat=100&ntype=1&cat=1004&ref=oUbmPwMP15b-CWnPZufOxS1_L_oM',
            imgUrl: 'http://wx.qlogo.cn/mmopen/PiajxSqBRaEI7VJQaPnZ4XMjUsXNicGC9skt6hnzNibcAqb5Yq9ObPYpp6d2Bnkf6DRibt270pXcqZIA35vSVgDKkA/0',
            success: function() {
                // 用户确认分享后执行的回调函数
                //alert('ok');
                var url = "http://wine.moqle.com/wx2/shareto";;
                var param = "plat=100&openid=oUbmPwMP15b-CWnPZufOxS1_L_oM&stype=pyq";
                dw.post(url, param, function(result) {

                });
            },
            cancel: function() {
                // 用户取消分享后执行的回调函数
            }
        });
        //获取“分享给朋友”按钮点击状态及自定义分享内容接口
        wx.onMenuShareAppMessage({
            title: '好友张扬推荐给你“安东尼奥” 百年酒庄 品牌故事，好东西自然要分享^_^',
            desc: 'TA请你看看，精彩当然只推荐给你，不许偷懒哦，快来看看...',
            link: 'http://wine.moqle.com/wx/newslist?plat=100&ntype=1&cat=1004&ref=oUbmPwMP15b-CWnPZufOxS1_L_oM',
            imgUrl: 'http://wx.qlogo.cn/mmopen/PiajxSqBRaEI7VJQaPnZ4XMjUsXNicGC9skt6hnzNibcAqb5Yq9ObPYpp6d2Bnkf6DRibt270pXcqZIA35vSVgDKkA/0',
            type: '',
            dataUrl: '',
            trigger: function(res) {

            },
            success: function() {
                var url = "http://wine.moqle.com/wx2/shareto";;
                var param = "plat=100&openid=oUbmPwMP15b-CWnPZufOxS1_L_oM&stype=py";
                dw.post(url, param, function(result) {

                });
            },
            cancel: function() {

            }
        });
    });

    var initPage = function() {}
    return {
        initPage: initPage
    }
})();

$(document).ready(function() {
    //$('.wine_footer').remove();
    wineApp.common.initHeaderIcon(0, true, {
        camera: false,
        search: false
    });
    wineApp.about.initPage();
    wx.config({
        debug: false,
        appId: 'wxb2cd0d2341253816',
        timestamp: _.now(),
        nonceStr: 'ecfvteshqccsnwt',
        signature: 'cc704d1dbc77bb60156ec4d894f3b770bf12d9da',
        jsApiList: ['checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'hideMenuItems', 'showMenuItems']
    });

    console.log(wx);

    wx.checkJsApi({
        jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo'],
        success: function(res) {
            console.log(res)
        },
        fail: function(res) {
            console.log(res)
        }
    });
});